package com.mr.model;

import java.sql.Timestamp;
import java.util.Date;

import org.hibernate.validator.constraints.NotEmpty;

import com.mr.util.DateUtil;

public class Discount extends BaseObject{
	private static final long serialVersionUID = -88449452130836250L;
	private Long id;
	private Long relatedid;
	@NotEmpty(message="名称不能为空！")
	private String name;
	private String content;
	private String status;
	private Date startdate;
	private Date enddate;
	private Timestamp addtime;
	public Discount(){
		this.addtime = DateUtil.getCurTimestamp();
		this.status = Status.Y;
	}
	public Discount(Long relatedid, String name, String content, Date startdate, Date enddate){
		this();
		this.relatedid = relatedid;
		this.name = name;
		this.content = content;
		this.startdate = startdate;
		this.enddate = enddate;
	}
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getRelatedid() {
		return relatedid;
	}

	public void setRelatedid(Long relatedid) {
		this.relatedid = relatedid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getStartdate() {
		return startdate;
	}
	public void setStartdate(Date startdate) {
		this.startdate = startdate;
	}
	public Date getEnddate() {
		return enddate;
	}

	public void setEnddate(Date enddate) {
		this.enddate = enddate;
	}

	public Timestamp getAddtime() {
		return addtime;
	}

	public void setAddtime(Timestamp addtime) {
		this.addtime = addtime;
	}
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (!(o instanceof Discount))
			return false;

		final Discount temp = (Discount) o;

		return !(this.getId() != null ? !(this.getId().equals(temp.getId()))
				: (temp.getId() != null));

	}

	public int hashCode() {
		return (this.getId() != null ? this.getId().hashCode() : 0);
	}

}
